Class: DataMaps::Executable Abstract
- Inherits:
-
Object
- Object
- DataMaps::Executable
- Defined in:
- lib/data_maps/executable.rb
Overview
This class is abstract.
Base class for executables (converter, when, then)
Direct Known Subclasses
Instance Attribute Summary collapse
-
#@option ⇒ Object
readonly
the given option.
- #option ⇒ Object readonly
Class Method Summary collapse
-
.valid_collection?(collection) ⇒ Boolean
Helper method to check if all the executable in a collection are valid objects of self.
Instance Method Summary collapse
-
#execute(data) ⇒ Object
The execute method to apply checks or mutations on the given data.
-
#initialize(option) ⇒ Executable
constructor
Initializer.
Constructor Details
#initialize(option) ⇒ Executable
Initializer
13 14 15 16 17 |
# File 'lib/data_maps/executable.rb', line 13 def initialize(option) @option = option self.after_initialize if self.respond_to? :after_initialize end |
Instance Attribute Details
#@option ⇒ Object (readonly)
the given option
7 8 9 |
# File 'lib/data_maps/executable.rb', line 7
def @option
@@option
end
|
#option ⇒ Object (readonly)
8 9 10 |
# File 'lib/data_maps/executable.rb', line 8 def option @option end |
Class Method Details
.valid_collection?(collection) ⇒ Boolean
Helper method to check if all the executable in a collection are valid objects of self
29 30 31 |
# File 'lib/data_maps/executable.rb', line 29 def self.valid_collection?(collection) collection.is_a?(Array) && collection.all?{ |w| w.is_a?(self) } end |
Instance Method Details
#execute(data) ⇒ Object
The execute method to apply checks or mutations on the given data
22 23 24 |
# File 'lib/data_maps/executable.rb', line 22 def execute(data) raise NotImplementedError.new("Please implement the execute method for your #{self.class.name}") end |